<article id="wikiArticle">
<div></div>
<p><code><strong>WeakMap</strong></code><strong><code>.prototype</code></strong>属性表现为 <a href="Reference/WeakMap" title="此页面仍未被本地化, 期待您的翻译!"><code>WeakMap</code></a>的构造器。</p>
<div><table class="standard-table">
<thead>
<tr>
<th class="header" colspan="2"><code>WeakMap.prototype</code> 属性的属性特性：</th>
</tr>
</thead>
<tbody>
<tr>
<td>writable</td>
<td>false</td>
</tr>
<tr>
<td>enumerable</td>
<td>false</td>
</tr>
<tr>
<td>configurable</td>
<td>false</td>
</tr>
</tbody>
</table></div>
<h2 id="描述">描述</h2>
<p><a href="Reference/WeakMap" title="此页面仍未被本地化, 期待您的翻译!"><code>WeakMap</code></a> 实例从 <a href="Reference/Global_Objects/WeakMap/prototype" title="WeakMap.prototype属性表现为 WeakMap的构造器。"><code>WeakMap.prototype</code></a>继承了所有属性。你可以在<code>WeakMap构造器中添加属性和方法，从而使得所有</code>实例中都有效。</p>
<p><code>WeakMap.prototype</code> 本身只是一个普通的对象：</p>
<pre><code  class="language-javascript">Object.prototype.toString.call(WeakMap.prototype); // "[object Object]"</code></pre>
<h2 id="属性">属性</h2>
<dl>
<dt><code>WeakMap.prototype.constructor</code></dt>
<dd>返回创建WeakMap实例的原型函数。 <a href="Reference/WeakMap" title="此页面仍未被本地化, 期待您的翻译!"><code>WeakMap</code></a>函数是默认的。</dd>
</dl>
<h2 id="方法">方法</h2>
<dl>
<dt><a href="Reference/Global_Objects/WeakMap/delete" title="delete() 方法可以从一个 WeakMap 对象中删除指定的元素。"><code>WeakMap.prototype.delete(key)</code></a></dt>
<dd>移除key的关联对象。执行后 <code>WeakMap.prototype.has(key)返回</code><code>false。</code></dd>
<dt><a href="Reference/Global_Objects/WeakMap/get" title="get() 方法返回  WeakMap 指定的元素。"><code>WeakMap.prototype.get(key)</code></a></dt>
<dd>返回<code>key关联对象</code>, 或者 <code>undefined</code>(没有key关联对象时)。</dd>
<dt><a href="Reference/Global_Objects/WeakMap/has" title="has() 方法根据WeakMap对象的元素中是否存在key键返回一个boolean值。"><code>WeakMap.prototype.has(key)</code></a></dt>
<dd>根据是否有key关联对象返回一个Boolean值。</dd>
<dt><a href="Reference/Global_Objects/WeakMap/set" title="set() 方法根据指定的key和value在 WeakMap对象中添加新/更新元素。"><code>WeakMap.prototype.set(key, value)</code></a></dt>
<dd>在WeakMap中设置一组key关联对象，返回这个 <code>WeakMap</code>对象。</dd>
<dt><s class="obsoleteElement"><a href="Reference/Global_Objects/WeakMap/clear" title="clear()用来从 WeakMap对象中移除所有元素。但不再是ECMAScript和它的实现部分。"><code>WeakMap.prototype.clear()</code></a> <span class="icon-only-inline" title="This is an obsolete API and is no longer guaranteed to work."><i class="icon-trash"> </i></span></s></dt>
<dd><s class="obsoleteElement">从<code>WeakMap中移除所有的</code> key/value 。 注意，该方法已弃用,但可以通过创建一个空的WeakMap并替换原对象来实现 (参看 <a href="Reference/WeakMap" title="此页面仍未被本地化, 期待您的翻译!"><code>WeakMap</code></a>的后半部分)</s></dd>
</dl>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/ecma-262/6.0/#sec-weakmap.prototype" hreflang="en" lang="en" rel="noopener">ECMAScript 2015 (6th Edition, ECMA-262)<br/><small lang="zh-CN">WeakMap.prototype</small></a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>Initial definition.</td>
</tr>
<tr>
<td><a class="external" href="https://tc39.github.io/ecma262/#sec-weakmap.prototype" hreflang="en" lang="en" rel="noopener">ECMAScript Latest Draft (ECMA-262)<br/><small lang="zh-CN">WeakMap.prototype</small></a></td>
<td><span class="spec-Draft">Draft</span></td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容">浏览器兼容</h2>
<p></p><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
            This compatibility table still uses the old format,
            because we haven't yet converted the data it contains.
            <strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
<div class="htab">
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
<ul>
<li class="selected"><a>Desktop</a></li>
<li><a>Mobile</a></li>
</ul>
</div><p></p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>36</td>
<td><a href="/en-US/Firefox/Releases/6" title="Released on 2011-08-16.">6.0</a> (6.0)</td>
<td>11</td>
<td>23</td>
<td>7.1</td>
</tr>
<tr>
<td>Ordinary object</td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td><a href="/en-US/Firefox/Releases/40" title="Released on 2015-08-11.">40</a> (40)</td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Chrome for Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td><span style="color: #f00;">未实现</span></td>
<td><span style="color: #f00;">未实现</span></td>
<td>6.0 (6.0)</td>
<td><span style="color: #f00;">未实现</span></td>
<td><span style="color: #f00;">未实现</span></td>
<td>8</td>
</tr>
<tr>
<td>Ordinary object</td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td>40.0 (40)</td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
<td><span style="color: rgb(255, 153, 0);" title="Compatibility unknown; please update this.">?</span></td>
</tr>
</tbody>
</table>
</div>
<h2 id="另请参阅">另请参阅</h2>
<ul>
<li><a href="Reference/Global_Objects/Map/prototype" title="Map.prototype 属性表示 Map构造函数的原型对象。"><code>Map.prototype</code></a></li>
</ul>
</article>